package com.gress.shop.util;

/**
 * @author gress
 * @version V1.0
 * @date 2017/9/8 上午11:11
 * @description 线程上下文参数获取,支持多线程场景
 */
public class ThreadLocalContext {
    private String lang;

    private static final ThreadLocal<ThreadLocalContext> THREAD_LOCAL = ThreadLocal.withInitial(ThreadLocalContext::new);

    public static ThreadLocalContext get() {
        return THREAD_LOCAL.get();
    }

    public static void clear() {
        THREAD_LOCAL.remove();
    }

    public String getLang() {
        return lang;
    }

    public void setLang(String lang) {
        this.lang = lang;
    }
}